<?php

require_once ROOT_DIR.'models/TodoList.php';
require_once ROOT_DIR.'views/TodoListJSON.php';

/**
 * Retrieves a the list of TodoList titles matching the parameters and echos the resulting view.
 * 
 * @param int $from Default is 0
 * @param int $rows Default is 30
 * @param string $order Default is asc
 */
function getListTitles($from = 0, $rows = -1, $order = 'asc', $owner = true){
	
	if(is_null($from)) $from = 0;
	if(is_null($rows)) $rows = -1;
	if(is_null($order)) $order = 'asc';
	if(is_null($owner)) $owner = true;
	
	$lists = TodoList::getLists($_SESSION['USER_ID'], true, $from, $rows, 't', $order, $owner);
	$listCount = TodoList::getListCount($_SESSION['USER_ID'], true, $owner);
	
	echo TodoListJSON::getView($lists, false, $listCount, true);
	
}

?>